package com.cdtye.itps.cms.dao.detect;

import com.baomidou.mybatisplus.annotation.*;
import com.cdtye.itps.cms.dao.enums.DelFlagEnum;
import com.google.gson.Gson;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @ClassName JcjcDefectTypeSection
 * @Description TODO
 * @Author wanglei
 * @Date 2021/10/10 11:22
 * @Version 1.0
 **/
@TableName("JCW_DEFECT_TYPE")
@Data
@ApiModel("接触网缺陷分类管理")
public class JcjcDefectTypeSection {

    private static final long serialVersionUID = 1L;

    /**
     * 缺陷分类名称
     */
    @TableField("DEFECT_TYPE_NAME")
    private String defectTypeName;

    /**
     * 缺陷分类编号
     */
    @TableField("DEFECT_TYPE_CODE")
    private String defectTypeCode;

    /**
     * 缺陷分类级联码
     */
    @TableField("DEFECT_TYPE_NO")
    private String defectTypeNo;

    /**
     * 父级id
     */
    @TableField("PARENT_ID")
    private String parentId;

    /**
     * 等级名称
     */
    @TableField("DEFECT_GRADE_NAME")
    private String defectGradeName;

    /**
     * 等级id
     */
    @TableField("DEFECT_GRADE_ID")
    private String defectGradeId;

    /* *//**
     * id的路径
     *//*
    @TableField("ID_PATH")
    private String idPath;*/

    /**
     * 描述
     */
    @TableField("REMARK")
    private String remark;

    /**
     * 排序号
     */
    @TableField("SORT_NUM")
    private String sortNum;

    @TableId(value = "DEFECT_TYPE_ID", type = IdType.ASSIGN_UUID)
    private String defectTypeId;

    @ApiModelProperty("创建时间")
    @TableField(value ="CREATE_DATETIME", fill = FieldFill.INSERT)
    private Date createDatetime;

    @ApiModelProperty("更新时间")
    @TableField(value ="UPDATE_DATETIME",fill = FieldFill.INSERT_UPDATE)
    private Date updateDatetime;

    @ApiModelProperty("删除标志，Y=是，N=否")
    @TableField(value ="DEL_FLAG", fill = FieldFill.INSERT)
    private String delFlag;

    @ApiModelProperty("创建人")
    @TableField(value ="CREATE_BY", fill = FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty("更新人")
    @TableField(value ="UPDATE_BY",fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    public JcwProblemDefectCategory covEntity() {
            Gson gs = new Gson();
            String listStr = gs.toJson(this);
        JcwProblemDefectCategory jcwProblemDefectCategoryBureau = gs.fromJson(listStr, JcwProblemDefectCategory.class);
            jcwProblemDefectCategoryBureau.setParentId(this.parentId);
//            jcwProblemDefectCategoryBureau.setId(null);
            jcwProblemDefectCategoryBureau.setSortNum(this.sortNum);
            jcwProblemDefectCategoryBureau.setCategoryCode(this.getDefectTypeNo());
            jcwProblemDefectCategoryBureau.setCategoryName(this.defectTypeName);
            jcwProblemDefectCategoryBureau.setUpdateDatetime(new Date());
            jcwProblemDefectCategoryBureau.setCreateDatetime(new Date());
            return jcwProblemDefectCategoryBureau;
        }
}
